home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 6 / coreaids.zip / FILEDATE.ASM < prev    next >
Assembly Source File  |  1987-06-25  |  2KB  |  85 lines

  1. ;    DESC:    Converts Bit-Mapped file date to ASCII format        V1.00
  2. ;    IN :    *file date in form yyyyyyymmmmmddddd
  3. ;        where mm is the month 1-12
  4. ;              dd is the day 1-31
  5. ;              yy is the year 0-119 (1980-2099)
  6. ;    OUT :    *segment and
  7. ;        *offset of the file date in the form
  8. ;        mm/dd/yy
  9. ;    SAMPLE:    Callm    FILEDATE,<DATE>,<ES,BX>
  10. ;    ################################################################
  11.  
  12. FILEDATD Segment Para Public 'FILEDATD'
  13. MONTH        DW    '10'            ;date to be returned in
  14.         DB    '/'            ;ASCII format.
  15. DAY        DW    '10'
  16.         DB    '/'
  17. YEAR        DW    '08'
  18. FILEDATD Ends
  19.  
  20.     Extrn    PUSHALL:Near
  21.     Extrn    POPALL:Near
  22.     Extrn    HEX_ASC:Near
  23.  
  24. FILEDATC    Segment
  25.     Assume    CS:FILEDATC,DS:FILEDATD
  26.     Public    FILEDATE
  27.  
  28.     Include    CALLM.MAC
  29.  
  30.                         ;notice.
  31.     DB    'FILEDATE - V1.00, Copyright 1987, CoreTechs   ',0DH,0AH
  32.  
  33. FILEDATE    Proc    Near
  34.  
  35.     Call    PUSHALL                ;save all registers.
  36.  
  37.     Mov    AX,FILEDATD            ;set up the workarea.
  38.     Mov    DS,AX
  39.  
  40.     Pop    DX                ;recover bit-mapped date.
  41.  
  42.     Mov    AX,01E0H            ;Mask out month from date.
  43.     And    AX,DX
  44.     Mov    CL,5
  45.     Shr    AX,CL
  46.  
  47.                         ;convert month to ASCII.
  48.     Callm    HEX_ASC,<0,AX>,<BX,BX,BX,BX,MONTH>
  49.     Mov    AX,MONTH            ;flip upper and lower parts
  50.     Xchg    AH,AL                ;of date components.
  51.     Mov    MONTH,AX
  52.  
  53.     Mov    AX,001FH            ;Mask out day from date.
  54.     And    AX,DX
  55.  
  56.                         ;convert day to ASCII.
  57.     Callm    HEX_ASC,<0,AX>,<BX,BX,BX,BX,DAY>
  58.     Mov    AX,DAY                ;flip upper and lower parts
  59.     Xchg    AH,AL                ;of date components.
  60.     Mov    DAY,AX
  61.  
  62.     Mov    AX,0FE00H            ;Mask out year from date.
  63.     And    AX,DX
  64.     Mov    CL,9
  65.     Shr    AX,CL
  66.     Add    AX,80                ;for offset from 1900.
  67.  
  68.                         ;convert year to ASCII.
  69.     Callm    HEX_ASC,<0,AX>,<BX,BX,BX,BX,YEAR>
  70.     Mov    AX,YEAR                ;flip upper and lower parts
  71.     Xchg    AH,AL                ;of date components.
  72.     Mov    YEAR,AX
  73.  
  74.     Mov    AX,OFFSET MONTH            ;return offset to date.
  75.     Push    AX
  76.     Push    DS
  77.  
  78.     Call    POPALL                ;recover all registers.
  79.  
  80.     Ret
  81.  
  82. FILEDATE    Endp
  83. FILEDATC    Ends
  84.     End
  85.